<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title><include file="./Application/Home/View/Common/title_prefix_text.html"/>热搜词</title>
    <link rel="stylesheet" href="__FORJS__/css/common/bootstrap.min.css"/>
    <link rel="stylesheet" href="__FORJS__/css/common/icon.ali.css"/>
    <link rel="stylesheet" href="__FORJS__/css/common/layout.css"/>
    <link rel="stylesheet" href="__FORJS__/css/common/modular.css"/>
    <link rel="stylesheet" href="__FORJS__/css/individual/hot_words.css"/>
    <script src="__FORJS__/js/common/jquery-1.9.1.min.js"></script>
    <script src="__FORJS__/js/common/bootstrap.min.js"></script>
    <script src="__FORJS__/js/jquery.pagination.js"></script>
    <script src="__FORJS__/js/common/bigwe_function.js"></script>
    <script src="__FORJS__/js/common/modular.js"></script>
</head>
<body>
    <div class="wrap">
        <div class="hotwords_main">
            <form>
                <div class="hotwords_up clearfix">
                    <div>
                        热搜词：<input type="text" name="hot_words" class="hot_words" value="">
                    </div>
                    <div>
                        热  度：<input type="text" name="heat" class="heat">（1-100数字）
                    </div>
                    <div>
                        <input type="button" value="提交" class="submit btn-success">
                    </div>
                </div>
            </form>

            <table class="redu" style="width: 1200px">
                <tr>
                   <td>编号</td>
                   <td style="width: 45%;">热词</td>
                   <td>热度</td>
                   <td>添加时间</td>
                    <td>操作人</td>
                   <td>操作</td>
                </tr>
            </table>
        </div>
    </div>
</body>
<script>
    $(function(){
        /*热搜词列表*/
        $.post("hot_words/get_hot_words",function(data){
            var htmlBuild = '';
            var json = eval('(' + data + ')').data;
            for(var i=0;i<json.length;i++){
                htmlBuild += '<tr><input type="hidden" class="id" value="'+json[i]['id']+'"><td>'+(i+1)+'</td><td>'+json[i]['hot_words']+'</td><td>'+json[i]['heat']+'</td><td>'+json[i]['create_time']+'</td><td>'+json[i]['op_person']+'</td><td><a href="javascript:;" class="delete" id="'+json[i]['id']+'">'+'删除'+'</a></td></tr>'
            }
           $('.redu').append(htmlBuild);
        });
        /*添加热搜词*/
        $('.submit').click(function(){
            var hot_words = $('.hot_words').val();
            var heat = $('.heat').val();
            $.post("hot_words/add_hot_words",{hot_words:hot_words,heat:heat},function(data){
                window.location.reload();
                $('.hotwords_up input[type=text]').val('');
            });
        });
        $('table.redu').on('click','.delete',function(){
            $(this).parents('tr').remove();
            hotwords_del($(this).attr('id'));
        });
        function hotwords_del(param){
             $.post("hot_words/delete_hot_words",{'id':param},function(data){
                var data = eval('(' + data + ')')
                if(data.ret==0){
                    ShowTitleMessage.show('删除成功', showTime);
                }
             });
        }
        /*删除热搜词  参数id   请求 hot_words/delete_hot_words*/

    })
</script>
</html>